home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / embed_base / nsEmbedAPI.h next >
C/C++ Source or Header  |  2006-05-08  |  6KB  |  173 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is the Mozilla browser.
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Netscape Communications, Inc.
  20.  * Portions created by the Initial Developer are Copyright (C) 1999
  21.  * the Initial Developer. All Rights Reserved.
  22.  *
  23.  * Contributor(s):
  24.  *   Adam Lock <adamlock@netscape.com>
  25.  *   Benjamin Smedberg <benjamin@smedbergs.us>
  26.  *
  27.  * Alternatively, the contents of this file may be used under the terms of
  28.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  29.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  30.  * in which case the provisions of the GPL or the LGPL are applicable instead
  31.  * of those above. If you wish to allow use of your version of this file only
  32.  * under the terms of either the GPL or the LGPL, and not to allow others to
  33.  * use your version of this file under the terms of the MPL, indicate your
  34.  * decision by deleting the provisions above and replace them with the notice
  35.  * and other provisions required by the GPL or the LGPL. If you do not delete
  36.  * the provisions above, a recipient may use your version of this file under
  37.  * the terms of any one of the MPL, the GPL or the LGPL.
  38.  *
  39.  * ***** END LICENSE BLOCK ***** */
  40.  
  41. #ifndef NSEMBEDAPI_H
  42. #define NSEMBEDAPI_H
  43.  
  44. #include "nscore.h"
  45. #include "nsXPCOM.h"
  46. #include "nsILocalFile.h"
  47. #include "nsIDirectoryService.h"
  48.  
  49. /**
  50.  * @file
  51.  * @brief The Gecko embedding API functions, structures and definitions.
  52.  */
  53.  
  54. /**
  55.  * Initialises the Gecko embedding layer. You <I>must</I>
  56.  * call this method before proceeding to use Gecko. This function ensures
  57.  * XPCOM is started, creates the component registry if necessary and
  58.  * starts global services.
  59.  *
  60.  * @status FROZEN
  61.  *
  62.  * @note Use <CODE>NS_NewLocalFile</CODE> to create the file object you
  63.  *       supply as the bin directory path in this call. The function
  64.  *       may be safely called before the rest of XPCOM or embedding has
  65.  *       been initialised.
  66.  *
  67.  * @param aMozBinDirectory The Gecko directory containing the component
  68.  *                         registry and runtime libraries;
  69.  *                         or use <CODE>nsnull</CODE> to use the working
  70.  *                         directory.
  71.  * @param aAppFileLocProvider The object to be used by Gecko that specifies
  72.  *                         to Gecko where to find profiles, the component
  73.  *                         registry preferences and so on; or use
  74.  *                         <CODE>nsnull</CODE> for the default behaviour.
  75.  * @param aStaticComponents An array of static components (see NS_InitXPCOM3).
  76.  *                         may be null.
  77.  * @param aStaticComponentCount Number of static components in the
  78.  *                              aStaticComponents array.
  79.  *
  80.  * @see NS_NewLocalFile
  81.  * @see nsILocalFile
  82.  * @see nsIDirectoryServiceProvider
  83.  *
  84.  * @return NS_OK for success;
  85.  *         other error codes indicate a failure during initialisation.
  86.  *
  87.  */
  88. extern "C" NS_HIDDEN NS_METHOD
  89. NS_InitEmbedding(nsILocalFile *aMozBinDirectory,
  90.                  nsIDirectoryServiceProvider *aAppFileLocProvider,
  91.                  nsStaticModuleInfo const *aStaticComponents = nsnull,
  92.                  PRUint32 aStaticComponentCount = 0);
  93.  
  94.  
  95. /**
  96.  * Terminates the Gecko embedding layer. Call this function during shutdown to
  97.  * ensure that global services are unloaded, files are closed and
  98.  * XPCOM is shutdown.
  99.  *
  100.  * @status FROZEN
  101.  *
  102.  * @note Release any XPCOM objects within Gecko that you may be holding a
  103.  *       reference to before calling this function.
  104.  *
  105.  * @return NS_OK
  106.  */
  107. extern "C" NS_HIDDEN NS_METHOD
  108. NS_TermEmbedding();
  109.  
  110. /*---------------------------------------------------------------------------*/
  111. /* Event processing APIs. The native OS dependencies mean you must be        */
  112. /* building on a supported platform to get the functions below.              */
  113. /*---------------------------------------------------------------------------*/
  114.  
  115. #undef MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
  116.  
  117. /* Win32 specific stuff */
  118. #if defined (WIN32) || defined (WINCE)
  119. #include "windows.h"
  120. /**
  121.  * @var typedef MSG nsEmbedNativeEvent
  122.  * 
  123.  * Embedding events are native <CODE>MSG</CODE> structs on Win32.
  124.  */
  125. typedef MSG nsEmbedNativeEvent;
  126. #define MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
  127. #endif
  128.  
  129. /* OS/2 specific stuff */
  130. #ifdef XP_OS2
  131. #include "os2.h"
  132.  
  133. /**
  134.  * @var typedef MSG nsEmbedNativeEvent
  135.  * 
  136.  * Embedding events are native <CODE>QMSG</CODE> structs on OS/2.
  137.  */
  138. typedef QMSG nsEmbedNativeEvent;
  139. #define MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
  140. #endif
  141.  
  142. /* Mac specific stuff */
  143. /* TODO implementation left as an exercise for the reader */
  144.  
  145. /* GTK specific stuff */
  146. /* TODO implementation left as an exercise for the reader */
  147.  
  148.  
  149. #ifdef MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
  150.  
  151. /**
  152.  * @fn nsresult NS_HandleEmbeddingEvent(nsEmbedNativeEvent &aEvent, PRBool &aWasHandled)
  153.  *
  154.  * This function gives Gecko the chance to process a native window events.
  155.  * Call this function from your message processing loop.
  156.  *
  157.  * @status UNDER_REVIEW
  158.  *
  159.  * @param aEvent The native UI event
  160.  * @param aWasHandled Returns with <CODE>PR_TRUE</CODE> if the end was
  161.  *                    handled; in which case it should not be handled by your
  162.  *                    application.
  163.  *
  164.  * @return NS_OK
  165.  */
  166. extern "C" NS_HIDDEN NS_METHOD
  167. NS_HandleEmbeddingEvent(nsEmbedNativeEvent &aEvent, PRBool &aWasHandled);
  168.  
  169. #endif /* MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING */
  170.  
  171. #endif /* NSEMBEDAPI_H */
  172.  
  173.